| 1 |  |  | window["libopenmpt"] = {}; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | libopenmpt.locateFile = function (filename) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |     return "//cdn.jsdelivr.net/gh/deskjet/chiptune2.js@master/" + filename; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | libopenmpt.onRuntimeInitialized = function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |     var player; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |     function init() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |         if (player == undefined) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |             player = new ChiptuneJsPlayer(new ChiptuneJsConfig(-1)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |         else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |             player.stop(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |             playPauseButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     function setMetadata(filename) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |         var metadata = player.metadata(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |         if (metadata["title"] != "") { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |             document.getElementById("title").innerHTML = metadata["title"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |             document.getElementById("title").innerHTML = filename; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         if (metadata["artist"] != "") { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |             document.getElementById("artist").innerHTML = "<br />" + metadata["artist"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |             document.getElementById("artist").innerHTML = ""; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     function afterLoad(path, buffer) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         document.querySelectorAll("#pitch,#tempo").forEach(e => e.value = 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         player.play(buffer); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         setMetadata(path); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         pausePauseButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     function loadURL(path) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         init(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         player.load(path, afterLoad.bind(this, path)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     function pauseButton() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         player.togglePause(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         switchPauseButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     function switchPauseButton() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         var button = document.getElementById("pause") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         if (button) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |             button.id = "play_tmp"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         button = document.getElementById("play") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         if (button) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |             button.id = "pause"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         button = document.getElementById("play_tmp") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         if (button) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |             button.id = "play"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |     function playPauseButton() { | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |         var button = document.getElementById("pause") | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |         if (button) { | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |             button.id = "play"; | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     function pausePauseButton() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         var button = document.getElementById("play") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         if (button) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |             button.id = "pause"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     var fileaccess = document.querySelector("*"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     fileaccess.ondrop = function (e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         e.preventDefault(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         var file = e.dataTransfer.files[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         init(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         player.load(file, afterLoad.bind(this, path)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     fileaccess.ondragenter = function (e) { e.preventDefault(); } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     fileaccess.ondragover = function (e) { e.preventDefault(); } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     document.querySelectorAll(".song").forEach(function (e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         e.addEventListener("click", function (evt) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |             modurl = evt.target.getAttribute("data-modurl"); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             loadURL(modurl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         }, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |     document.querySelector("input[name=files]").addEventListener("change", function (evt) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         loadURL(evt.target.files[0]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     document.querySelector("input[name=submiturl]").addEventListener("click", function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         var exturl = document.querySelector("input[name=exturl]"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         modurl = exturl.value; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         loadURL(modurl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         exturl.value = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |     document.querySelector("#play").addEventListener("click", pauseButton, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     document.querySelector("#pitch").addEventListener("input", function (e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |         player.module_ctl_set("play.pitch_factor", e.target.value.toString()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     }, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     document.querySelector("#tempo").addEventListener("input", function (e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         player.module_ctl_set("play.tempo_factor", e.target.value.toString()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     }, false); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 120 |  |  | }; | 
            
                                                        
            
                                    
            
            
                | 121 |  |  |  | 
            
                        
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.